package com.yonyou.isv.demo.openapi.api.currency;

import com.yonyou.isv.demo.openapi.base.module.reponse.ApiDataArrayResponse;
import com.yonyou.isv.demo.openapi.base.module.reponse.ApiDataResponse;
import com.yonyou.isv.demo.openapi.api.BaseOpenApi;
import com.yonyou.isv.demo.openapi.api.OpenApiURL;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @description: 用友币种放平台接口
 * @author: nishch
 * @create: 2021-07-08
 **/
@Component
public class CurrencyApi extends BaseOpenApi {

    public Map<String, Object> list(Map<String, Object> params) {
        ApiDataResponse apiDataResponse =  postForEntity(OpenApiURL.CURRENCY_LIST,params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }
    public Map<String,Object> detail(Map<String,String> params)
    {
        ApiDataResponse apiDataResponse =  getForEntity(OpenApiURL.CURRENCY_DETAIL,params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }
    public List<Map<String, Object>> findByTime(Map<String,String> params)
    {
        ApiDataArrayResponse apiDataArrayResponse=getForEntity(OpenApiURL.CURRENCY_FIND_BY_TIME,params,ApiDataArrayResponse.class);
        return getData(apiDataArrayResponse);
    }
    public Map<String,Object> save(Map<String,Object> params)
    {
        ApiDataResponse apiDataResponse = postForEntity(OpenApiURL.CURRENCY_SAVE, params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }
    public Map<String ,Object> query(Map<String,Object> params)
    {
        ApiDataResponse apiDataResponse = postForEntity(OpenApiURL.CURRENCY_QUERY, params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }

    /**
     * 会计期间方案查询
     * @param params
     * @return
     */
    public Map<String, Object> accountingList(Map<String, Object> params) {
        ApiDataResponse apiDataResponse =  postForEntity(OpenApiURL.ACCOUNTING_LIST,params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }

}
